<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JSON to HTML Table Demo</title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="form2object.js"></script>
<script type="text/javascript" src="json2.js"></script>

<script type="text/javascript">
	function submitData() {
		var formData = form2object('userform', '.', true, function(node) {
			if (node.id && node.id.match(/callbackTest/)) {
				return {
					name : node.id,
					value : node.innerHTML
				};
			}
		});
		$.ajax({
			url : '../categories/create',
			type : 'POST',
			data : JSON.stringify(formData, null, '\t'),
			dataType : 'json',
			contentType : "application/json; charset=utf-8",
			success : function(result) {
				alert('finished');
			}
		});
	}
	$('document').ready(function() {

	});
</script>

</head>
<body>
<h1>Create Category</h1>
	<form id="userform" action="javascript:submitData()">
		<table>
			<tr>
				<td>Category Name</td>
				<td><input type="text" name="passwordCategoryName" />
				</td>
			</tr>
			
			<tr>
				<td />
				<td><input type="submit" name="submitBtn" /></td>
			</tr>
		</table>
	</form>
</body>
</html>
